home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-05-21 | 650 b | 35 lines | [TEXT/ttxt] |
- --<<<
- -- Kaleida Labs, Inc.
- -- Field Guide to the ScriptX Language
- -- chapter 6, example 5
-
- -- examples of defining methods
-
- object myObj (RootObject)
- inst vars a:500
- inst methods
- method incrementA self inc -> (
- self.a := self.a + inc
- )
- end
-
- class GenericClass (RootObject)
- instance methods
- method printClass self -> (
- print ("I'm an instance of " + (getClassName self))
- )
- method printMe self -> (
- format debug "This is me: %*.\n" self @Normal
- printClass self
- )
- end
-
- class MyLL (Array)
- instance methods
- method addItemToBeginning self item -> (
- addNth self 1 item
- format debug "%* added" item @Normal
- return self
- )
- end
- -->>>